package com.vint.mi;

import com.vint.common.StringCommons;

/**
 * 1. easy
 * 2. 数组操作
 * 求最大矩形
 * [1,2,3...]表示一组宽度为1，高度为给定值的小方块，排在一起
 */
public class Mi50 {

    public static String solution(String line){
        int[] src = StringCommons.StringToIns(line);
        int max = 0;
        for(int i = 0; i < src.length; i++){
           int width = 1;
           for(int j = i+1; j<src.length; j++) {
               if(src[j]>=src[i])
                   width++;
               else
                   break;
           }

            for(int j = i-1; j>=0; j--){
                if(src[j]>=src[i])
                    width++;
                else
                    break;
            }
            if(width*src[i]>max){
                max = width * src[i];
            }
        }
        return max+"";
    }
    public static void main(String[] args) {
        String ex1 = "4,13,5,6,35,34,3";
        String ex2 = "13,3,6,8,12,4,45,56,66,16";
        String ex3 = "6,4,16";
        System.out.println(solution(ex1));
        System.out.println(solution(ex2));
        System.out.println(solution(ex3));

    }
}
